<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <div id="app">
        <p v-if="isActive">v-if 这是v-if</p>
        <p v-else>这是  else</p>
        <p v-show="isActive">v-show 演示</p>
        <button @click="switchAciton">切换状态</button>

        <p v-if="num == 0">num 值为0</p>
        <p v-else-if="num == 1">num     值为1</p>
        <p v-else>num 不是0也不是1</p>
        <button @click="changeNum(0)">num 值为0</button>
        <button @click="changeNum(1)">num      =1</button>
        <button @click="changeNum(2)">num 值不是0也不是1</button>
    </div>
    <script>
        const app = Vue.createApp
        ({
            data(){
                return{
                    isActive: true,
                    num:0
                }
            },
            
            methods:{
                switchAciton(){
                    this.isActive = !this.isActive
                    console.log('this.isActive', this.isActive);
                },
                changeNum(number){
                    this.num = number
                }
            }
            
        })
        app.mount("#app")
    </script>
    
</body>
</html>